package com.lifeng.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lifeng on 2019/5/27.
 * @RefreshScope，主要用来让这个类下的配置内容支持动态刷新，
 * 也就是当我们的应用启动之后，
 * 修改了Nacos中的配置内容之后，这里也会马上生效
 */
@RestController
@RefreshScope
public class UserController {
    private static final Logger log = LoggerFactory.getLogger(UserController.class);
    @Value("${myapp.name}")
    private String name;

    @RequestMapping("/info")
    public String getInfo(){
        return "myapp.name:"+name;
    }
}
